reftests: Add a reftest for nth-child
authorBenjamin Otte <otte@redhat.com>
Sun, 18 Mar 2012 01:53:44 +0000 (02:53 +0100)
committerBenjamin Otte <otte@redhat.com>
Tue, 17 Apr 2012 06:59:08 +0000 (08:59 +0200)
Prime numbers are fun.

tests/reftests/Makefile.am
tests/reftests/nth-child.css [new file with mode: 0644]
tests/reftests/nth-child.ref.ui [new file with mode: 0644]
tests/reftests/nth-child.ui [new file with mode: 0644]

index 6b13388066e0d2700a2ab331c3a39f721d3baa09..2c5fe8c013ad3b5db4133e275996f2a2ab2fcd4e 100644 (file)
@@ -185,6 +185,9 @@ EXTRA_DIST += \
        nonresizable-size.ui \
        notebook-childproperties.ui \
        notebook-childproperties.ref.ui \
+       nth-child.css \
+       nth-child.ref.ui \
+       nth-child.ui \
        paned-undersized.css \
        paned-undersized.ref.ui \
        paned-undersized.ui \
diff --git a/tests/reftests/nth-child.css b/tests/reftests/nth-child.css
new file mode 100644 (file)
index 0000000..4b177eb
--- /dev/null
@@ -0,0 +1,148 @@
+/* For nth-child, we have a custom rule for every multiple of
+ * the prime numbers.
+ * For nth-last-child, we also color the prime number itself.
+ */
+
+:nth-child(2n+2),
+:nth-last-child(-2n+200) {
+  color: blue;
+}
+
+:nth-child(3n+3),
+:nth-last-child(3n-300) {
+  font-weight: bold;
+}
+
+:nth-child(5n+5),
+:nth-last-child(-5n+500) {
+  font-style: italic;
+}
+
+:nth-child(7n+7),
+:nth-last-child(7n-700) {
+  text-shadow: red 1 1;
+}
+
+:nth-child(11n+11),
+:nth-last-child(-11n+1100) {
+  text-shadow: green 1 1;
+}
+
+#ref1 {
+  font-style: italic;
+}
+
+#ref2 {
+  color: blue;
+  font-weight: bold;
+}
+
+#ref3 {
+}
+
+#ref4 {
+  color: blue;
+  text-shadow: green 1 1;
+}
+
+#ref5 {
+  font-weight: bold;
+  text-shadow: red 1 1;
+}
+
+#ref6 {
+  color: blue;
+  font-weight: bold;
+  font-style: italic;
+}
+
+#ref7 {
+}
+
+#ref8 {
+  color: blue;
+  font-weight: bold;
+}
+
+#ref9 {
+  font-weight: bold;
+}
+
+#ref10 {
+  color: blue;
+  font-style: italic;
+}
+
+#ref11 {
+  font-weight: bold;
+  font-style: italic;
+}
+
+#ref12 {
+  color: blue;
+  font-weight: bold;
+  text-shadow: red 1 1;
+}
+
+#ref13 {
+}
+
+#ref14 {
+  color: blue;
+  font-weight: bold;
+  text-shadow: red 1 1;
+}
+
+#ref15 {
+  font-weight: bold;
+  font-style: italic;
+  text-shadow: green 1 1;
+}
+
+#ref16 {
+  color: blue;
+  font-style: italic;
+}
+
+#ref17 {
+  font-weight: bold;
+}
+
+#ref18 {
+  color: blue;
+  font-weight: bold;
+}
+
+#ref19 {
+  text-shadow: red 1 1;
+}
+
+#ref20 {
+  color: blue;
+  font-weight: bold;
+  font-style: italic;
+}
+
+#ref21 {
+  font-weight: bold;
+  font-style: italic;
+  text-shadow: red 1 1;
+}
+
+#ref22 {
+  color: blue;
+  text-shadow: green 1 1;
+}
+
+#ref23 {
+  font-weight: bold;
+}
+
+#ref24 {
+  color: blue;
+  font-weight: bold;
+}
+
+#ref25 {
+  font-style: italic;
+}
diff --git a/tests/reftests/nth-child.ref.ui b/tests/reftests/nth-child.ref.ui
new file mode 100644 (file)
index 0000000..f0481bc
--- /dev/null
@@ -0,0 +1,289 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkWindow" id="window1">
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkGrid" id="grid1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkLabel" id="label1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">1</property>
+            <property name="name">ref1</property>
+          </object>
+          <packing>
+            <property name="top-attach">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">2</property>
+            <property name="name">ref2</property>
+          </object>
+          <packing>
+            <property name="top-attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label8">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">3</property>
+            <property name="name">ref3</property>
+          </object>
+          <packing>
+            <property name="top-attach">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label3">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">4 = 2 * 2</property>
+            <property name="name">ref4</property>
+          </object>
+          <packing>
+            <property name="top-attach">3</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label9">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">5</property>
+            <property name="name">ref5</property>
+          </object>
+          <packing>
+            <property name="top-attach">4</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label10">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">6 = 2 * 3</property>
+            <property name="name">ref6</property>
+          </object>
+          <packing>
+            <property name="top-attach">5</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label11">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">7</property>
+            <property name="name">ref7</property>
+          </object>
+          <packing>
+            <property name="top-attach">6</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label4">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">8 = 2 * 2 * 2</property>
+            <property name="name">ref8</property>
+          </object>
+          <packing>
+            <property name="top-attach">7</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label12">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">9 = 3 * 3</property>
+            <property name="name">ref9</property>
+          </object>
+          <packing>
+            <property name="top-attach">8</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label5">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">10 = 2 * 5</property>
+            <property name="name">ref10</property>
+          </object>
+          <packing>
+            <property name="top-attach">9</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label14">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">11</property>
+            <property name="name">ref11</property>
+          </object>
+          <packing>
+            <property name="top-attach">10</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label13">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">12 = 2 * 2 * 3</property>
+            <property name="name">ref12</property>
+          </object>
+          <packing>
+            <property name="top-attach">11</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label7">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">13</property>
+            <property name="name">ref13</property>
+          </object>
+          <packing>
+            <property name="top-attach">12</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label15">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">14 = 2 * 7</property>
+            <property name="name">ref14</property>
+          </object>
+          <packing>
+            <property name="top-attach">13</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label16">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">15 = 3 * 5</property>
+            <property name="name">ref15</property>
+          </object>
+          <packing>
+            <property name="top-attach">14</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label17">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">16 = 2 * 2 * 2 * 2</property>
+            <property name="name">ref16</property>
+          </object>
+          <packing>
+            <property name="top-attach">15</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label6">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">17</property>
+            <property name="name">ref17</property>
+          </object>
+          <packing>
+            <property name="top-attach">16</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label18">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">18 = 2 * 3 * 3</property>
+            <property name="name">ref18</property>
+          </object>
+          <packing>
+            <property name="top-attach">17</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label19">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">19</property>
+            <property name="name">ref19</property>
+          </object>
+          <packing>
+            <property name="top-attach">18</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label21">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">20 = 2 * 2 * 5</property>
+            <property name="name">ref20</property>
+          </object>
+          <packing>
+            <property name="top-attach">19</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label20">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">21 = 3 * 7</property>
+            <property name="name">ref21</property>
+          </object>
+          <packing>
+            <property name="top-attach">20</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label22">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">22 = 2 * 11</property>
+            <property name="name">ref22</property>
+          </object>
+          <packing>
+            <property name="top-attach">21</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label23">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">23</property>
+            <property name="name">ref23</property>
+          </object>
+          <packing>
+            <property name="top-attach">22</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label24">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">24 = 2 * 2 * 2 * 3</property>
+            <property name="name">ref24</property>
+          </object>
+          <packing>
+            <property name="top-attach">23</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label25">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">25 = 5 * 5</property>
+            <property name="name">ref25</property>
+          </object>
+          <packing>
+            <property name="top-attach">24</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/tests/reftests/nth-child.ui b/tests/reftests/nth-child.ui
new file mode 100644 (file)
index 0000000..fd9e503
--- /dev/null
@@ -0,0 +1,314 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkWindow" id="window1">
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkBox" id="box1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkLabel" id="label1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">1</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">2</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label8">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">3</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label3">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">4 = 2 * 2</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">3</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label9">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">5</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">4</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label10">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">6 = 2 * 3</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">5</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label11">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">7</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">6</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label4">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">8 = 2 * 2 * 2</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">7</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label12">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">9 = 3 * 3</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">8</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label5">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">10 = 2 * 5</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">9</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label14">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">11</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">10</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label13">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">12 = 2 * 2 * 3</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">11</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label7">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">13</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">12</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label15">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">14 = 2 * 7</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">13</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label16">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">15 = 3 * 5</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">14</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label17">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">16 = 2 * 2 * 2 * 2</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">15</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label6">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">17</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">16</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label18">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">18 = 2 * 3 * 3</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">17</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label19">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">19</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">18</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label21">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">20 = 2 * 2 * 5</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">19</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label20">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">21 = 3 * 7</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">20</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label22">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">22 = 2 * 11</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">21</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label23">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">23</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">22</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label24">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">24 = 2 * 2 * 2 * 3</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">23</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label25">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">25 = 5 * 5</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">24</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>